import db
import random
DB = db.MyMarialdb("8.134.23.250",5102,"admin01","@Tjczcs20041922","subject")
#lenght = DB.getLenght("danxuanti")

#print(DB.getTixing("duanxuanti"))

#print(DB._getJiegou(DB._getJiegouNumber("duanxuanti")))
#print(DB._getJiegou(DB._getJiegouNumber("duoxuanti")))
#print(DB._getJiegou(DB._getJiegouNumber("panduanti")))
#三种提醒插入例子
#DB.insertDanxuanDatatable("danxuanti",lenght+1,"题目","选择A","选择B","选择C","选择D","选择",0,1)
#DB.CharuDuoxuanti("题目","选择A","选择B","选择C","选择D","选择",0,1)
#DB.CharuPanduanti("题目","对",0,1)

#for count in range(1,DB.getLenght("duoxuanti") ):
#    print(DB.GetDuoxuanti(count))
#for count in range(1,DB.getLenght("danxuanti") ):
#    print(DB.GetDanxuanti(count))
#for count in range(1,DB.getLenght("panduanti") ):
#    print(DB.GetPanduanti(count))

#for count in range(0,100):
#    DB.CharuPanduanti()
#测试选择
#tut = DB.GetTextNandu("text",20,60)
#timu= []
#元祖转列表
#for d  in tut:
#    timu.append(list(d))
#print(timu)

fenlei = DB.GetFenLei("panduanti",1)
timu = []
for id in fenlei:
    timu.append(list(id)[0])
timulist = []
for _ in range(10):
    id = timu[random.randint(0,len(timu)-1)]
    timulist.append(id)
    timu.remove(id)
print(timulist)
print(len(timulist))
timulist1 = []
for _ in range(10):
    id = timulist[random.randint(0,len(timulist)-1)]
    timulist1.append(id)
    timulist.remove(id)
print(timulist1)
print(len(timulist1))
#for id in timulist:
#    print(DB.GetPanduanti(id))
#print(f"id 类型是 {type(id)}")
#print(DB.GetPanduanti(int(id)))



